import javax.swing.tree.TreeNode;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:或者说我先把课给补完呢
 * User: liangyuanzhang
 * Date: 2025-5-14
 * Time: 23:36
 */

public class Test {

    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> result = new ArrayList<>();
        inorderHelper(root, result);
        return result;
    }

    private void inorderHelper(TreeNode node, List<Integer> list) {
        if (node == null)
            return;
        inorderHelper(node.left, list); // 遍历左子树
        list.add(node.val); // 访问根节点
        inorderHelper(node.right, list); // 遍历右子树
    }

    public static void main(String[] args) {
        System.out.println("我要先把课程补完，回来复习的时候再做作业");
    }
}
